// 统一管理学生相关请求接口方法
// 引入自己封装的axios方法
import request from "@/utils/request";
import type { studentAllResponseData, studentInfoData, studentListFormData, studentListResponseData, studentResponseData } from "./type";
// 请求地址枚举
// @ts-ignore
enum API{
    STUDENT_ALL_URL="/manage/student/all",
    STUDENT_LIST_URL="/manage/student/list",
    STUDENT_ADD_URL="/manage/student/add",
    STUDENT_GET_ID_URL="/manage/student/find",
    STUDENT_UPDATE_URL="/manage/student/update",
    STUDENT_DELETE_URL="/manage/student/delete",
}
// 获取所有学生
export const reqStudentAll =()=>request.get<any,studentAllResponseData>(API.STUDENT_ALL_URL)
// 分页获取所有学生
export const reqStudentList =(data:studentListFormData)=>request.post<any,studentListResponseData>(API.STUDENT_LIST_URL,data)
// 添加学生
export const reqStudentAdd=(data:studentInfoData)=>request.post<any,studentResponseData>(API.STUDENT_ADD_URL,data)
// 查找所有学生信息（通过id）
export const reqStudentById =(_id:string)=>request.get<any,studentResponseData>(API.STUDENT_GET_ID_URL+`?_id=${_id}`)
// 修改学生信息
export const reqStudentUpdata =(data:studentInfoData)=>request.post<any,studentResponseData>(API.STUDENT_UPDATE_URL,data)
// 删除学生
export const reqStudentDelete =(studentId:string)=>request.post<any,studentResponseData>(API.STUDENT_DELETE_URL,{studentId})